package com.tjec.project.projectShowLibrary.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tjec.framework.aspectj.lang.annotation.Log;
import com.tjec.framework.aspectj.lang.enums.BusinessType;
import com.tjec.framework.web.controller.BaseController;
import com.tjec.framework.web.domain.AjaxResult;
import com.tjec.common.utils.poi.ExcelUtil;
import com.tjec.framework.web.page.TableDataInfo;
import com.tjec.project.projectShowLibrary.domain.BmsProjectShowOper;
import com.tjec.project.projectShowLibrary.service.IBmsProjectShowOperService;

/**
 * 项目展示库操作记录Controller
 * 
 * @author tjec
 * @date 2021-05-10
 */
@RestController
@RequestMapping("/system/oper")
public class BmsProjectShowOperController extends BaseController
{
    @Autowired
    private IBmsProjectShowOperService bmsProjectShowOperService;

    /**
     * 查询项目展示库操作记录列表
     */
    //@PreAuthorize("@ss.hasPermi('system:oper:list')")
    @GetMapping("/list")
    public TableDataInfo list(BmsProjectShowOper bmsProjectShowOper)
    {
        startPage();
        List<BmsProjectShowOper> list = bmsProjectShowOperService.selectBmsProjectShowOperList(bmsProjectShowOper);
        return getDataTable(list);
    }

    /**
     * 导出项目展示库操作记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:oper:export')")
    @Log(title = "项目展示库操作记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BmsProjectShowOper bmsProjectShowOper)
    {
        List<BmsProjectShowOper> list = bmsProjectShowOperService.selectBmsProjectShowOperList(bmsProjectShowOper);
        ExcelUtil<BmsProjectShowOper> util = new ExcelUtil<BmsProjectShowOper>(BmsProjectShowOper.class);
        return util.exportExcel(list, "oper");
    }

    /**
     * 获取项目展示库操作记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:oper:query')")
    @GetMapping(value = "/{guid}")
    public AjaxResult getInfo(@PathVariable("guid") String guid)
    {
        return AjaxResult.success(bmsProjectShowOperService.selectBmsProjectShowOperByGuid(guid));
    }

    /**
     * 新增项目展示库操作记录
     */
    @PreAuthorize("@ss.hasPermi('system:oper:add')")
    @Log(title = "项目展示库操作记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BmsProjectShowOper bmsProjectShowOper)
    {
        return toAjax(bmsProjectShowOperService.insertBmsProjectShowOper(bmsProjectShowOper));
    }

    /**
     * 修改项目展示库操作记录
     */
    @PreAuthorize("@ss.hasPermi('system:oper:edit')")
    @Log(title = "项目展示库操作记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BmsProjectShowOper bmsProjectShowOper)
    {
        return toAjax(bmsProjectShowOperService.updateBmsProjectShowOper(bmsProjectShowOper));
    }

    /**
     * 删除项目展示库操作记录
     */
    @PreAuthorize("@ss.hasPermi('system:oper:remove')")
    @Log(title = "项目展示库操作记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{guids}")
    public AjaxResult remove(@PathVariable String[] guids)
    {
        return toAjax(bmsProjectShowOperService.deleteBmsProjectShowOperByGuids(guids));
    }
}
